package com.tech.service.impl;

import com.tech.mapper.UserDao;
import com.tech.mapper.factory.DaoImplFactory;
import com.tech.repository.entity.User;
import com.tech.service.UserService;

public class UserServiceImpl implements UserService {
	private UserDao userDao = DaoImplFactory.getUserDao();

	@Override
	public User login(String username, String password) {
		return userDao.login(username, password);
	}

	/**
	 * 注册用户，注册成功返回User对象，注册失败返回null
	 *
	 */
	@Override
	public User register(User user) {
		if (userDao.addUser(user) != 1)
			return null;
		return user;
	}
}
